import request from '@/router/axios';
// 加载info节点下 所有图片的信息
export const getImgList = (pid) => {
  return request({
    url: '/api/data-drawing-info/drawinginfo/getImgAttachListByPid',
    method: 'get',
    params:{
      pid
    }
  })
}


// 懒加载树形结构
export const getLazyTree = (parentId, id, drawingInfo) => {
  return request({
    url: '/api/data-drawing-info/drawinginfo/lazy-tree',
    method: 'get',
    params: {
      parentId,
      id,
      drawingInfo
    }
  })
}
// 一次性加载树中的数据
export const getTreeList = (drawingInfo) => {
  return request({
    url: '/api/data-drawing-info/drawinginfo/getTreeList',
    method: 'get',
    params: {
      drawingInfo,
    }
  })
}

// 加载树形节点中的详情数据
export const getTreeNodeDetail = (id) => {
  return request({
    url:'/api/data-drawing-info/drawinginfo/getTreeNodeById',
    method:'get',
    params:{
      id
    }
  })
}
// 获取图纸类型List
export const getDrawingTypeList = () => {
  return request({
    url:'/api/data-category/drawingcategory/getDrawingCateGoryList',
    method:'get',
  })
}


// 加载树形结构的数据
export const getTreeNode = () => {
  return request({
    url:'/api/data-drawing-info/drawinginfo/getTreeNodeList',
    method:'get',
  })
}


// 已经归档的图纸对象的附件信息
export  const getFileById  = (id) => {
  return request({
    url: '/api/data-drawing-info/drawinginfo/getFileList',
    method: 'get',
    params:{
      id
    }
  })
}


// 获取数据库中的树形结构
export const getLazyList = (parentId, params) => {
  return request({
    url: '/api/data-drawing-info/drawinginfo/lazy-list',
    method: 'get',
    params: {
      ...params,
      parentId
    }
  })
}
// 通过node节点id得到图纸信息
export const getDrawingInfoByNodeId = (nodeId) => {
  return request({
    url:'/api/data-drawing-info/drawinginfo/getDrawingInfoByNodeId',
    method:'get',
    params:{
      nodeId
    }
  })
}

// 获取树形结构
export const getDrwwingTree = (tenantId) => {
  return request({
    url: '/api/blade-system/menu/tree',
    method: 'get',
    params: {
      tenantId,
    }
  })
}
// detail
export const getDrawingInfo = (id) => {
  return request({
    url: '/api/data-drawing-info/drawinginfo/detail',
    method: 'get',
    params: {
      id,
    }
  })
}


// 获取字典表中的值
export const getDictValueList = (code) => {
  return request({
    url: '/api/blade-system/dict/dictionary',
    method:'get',
    params:{
      code
    }
  })
}


// 将excel的信息上传到临时接口中
export const uploadFiles = (formData) => {
  return request({
    url: '/api/data-drawing-attach/drawingattach/excel',
    method: 'post',
    data: formData
  })
}

export const getList = (current, size, params) => {
  return request({
    url: '/api/data-drawing-info/drawinginfo/getRightList',
    method: 'get',
    params: {
      ...params,
      current,
      size,
    }
  })
}

export const getDetail = (id) => {
  return request({
    url: '/api/blade-resource/attach/detail',
    method: 'get',
    params: {
      id
    }
  })
}

export const remove = (ids) => {
  return request({
    url: '/api/blade-resource/attach/remove',
    method: 'post',
    params: {
      ids,
    }
  })
}

export const add = (row) => {
  return request({
    url: '/api/blade-resource/attach/submit',
    method: 'post',
    data: row
  })
}

export const update = (row) => {
  return request({
    url: '/api/blade-resource/attach/submit',
    method: 'post',
    data: row
  })
}

